You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds GET /v1-alpha/oss-index/collections (IN-1416, epic IN-1146). It returns a cursor-paged list of OSS Index collections with their top projects, plus the category details when a category is picked.
categorySlug and categoryGroupId filter the collections. sort (totalContributors or softwareValue, default totalContributors) orders them. cursor and pageSize page them like the leaderboard routes.
With categorySlug, the route reads the category from category_list first and returns it as category. An unknown slug answers 404 not_found, and the collections pipe is then skipped.
Collections come from collections_oss_index. Their project tuples carry slug, so src/lib/oss-index.ts gains CollectionProject and its guard and mapper. Collection projects carry the same v2 health fields as the other OSS Index endpoints.
An invalid cursor answers 400. A malformed row answers 503 upstream_unavailable.
Notes
The pipe's total row count ignores the category filter, so the route detects the last page from a short pipe page. A full last page may return a nextCursor that leads to an empty page.
Counts and software values must be non-negative integers, matching the groups and categories endpoints.
tests/oss-index-collections.test.ts: filter and sort forwarding, the category lookup and 404, tuple mapping, paging across pipe pages with the cursor walk, 400 for bad input, 503 for malformed rows, and the OpenAPI entry.
tests/oss-index.test.ts: the 14-slot guard and mapper.
Medium Risk
New read-only API surface with multi-upstream orchestration and non-obvious pagination when category filters are applied; follows established OSS Index patterns with strict row validation.
Overview
Adds GET /v1-alpha/oss-index/collections, a cursor-paged list of OSS Index collections (totals, topProjects, optional category metadata) backed by Tinybird pipes collections_oss_index and category_list.
oss-index.ts gains CollectionProject support for the collections pipe’s 14-slot project tuples (slug inserted before status): isCollectionProjectTuple, toCollectionProject, and a TypeBox schema extending TopProject with slug.
The route accepts categorySlug / categoryGroupId filters and sort (totalContributors or softwareValue). With categorySlug, it resolves the category first (404 not_found and skips the collections pipe if missing), then includes category on the response. Pagination matches other OSS Index leaderboard routes; nextCursor may point to an empty page when the last pipe page is full because upstream totals ignore the category filter. Malformed upstream rows yield 503upstream_unavailable.
Tests cover mapping, query forwarding, category 404/503, paging/cursor walks, validation 400s, and OpenAPI; unit tests cover the new tuple guard and mapper.
Reviewed by Cursor Bugbot for commit 5cf72de. Bugbot is set up for automated code reviews on this repo. Configure here.
This guarantee is too broad: with pageSize=2, cursor offset 1, and three rows total, the second pipe page is short and this handler returns nextCursor: null despite returning two rows. Document that only some full final responses produce an empty follow-up page.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
The implementation matches the described contract and includes comprehensive validation and tests.
0 open findings
🧠 Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
GET /v1-alpha/oss-index/collections(IN-1416, epic IN-1146). It returns a cursor-paged list of OSS Index collections with their top projects, plus the category details when a category is picked.categorySlugandcategoryGroupIdfilter the collections.sort(totalContributorsorsoftwareValue, defaulttotalContributors) orders them.cursorandpageSizepage them like the leaderboard routes.categorySlug, the route reads the category fromcategory_listfirst and returns it ascategory. An unknown slug answers 404not_found, and the collections pipe is then skipped.collections_oss_index. Their project tuples carryslug, sosrc/lib/oss-index.tsgainsCollectionProjectand its guard and mapper. Collection projects carry the same v2 health fields as the other OSS Index endpoints.upstream_unavailable.Notes
nextCursorthat leads to an empty page.Tests
tests/oss-index-collections.test.ts: filter and sort forwarding, the category lookup and 404, tuple mapping, paging across pipe pages with the cursor walk, 400 for bad input, 503 for malformed rows, and the OpenAPI entry.tests/oss-index.test.ts: the 14-slot guard and mapper.main